/*********************************
 * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
 * Copyright (c) 2012 NVision Group, Inc. All rights reserved.
 *
 * NvgMessageBox.java 29.06.2012 10:43:45
 *********************************/
package ru.kruzhki.client.gwt;

import com.google.gwt.safehtml.shared.SafeHtml;
import com.sencha.gxt.widget.core.client.box.MessageBox;

/**
 * @author AKovalyov
 *
 */
public final class NvgMessageBox extends MessageBox {
    
    /**
     * @param headingHtml
     * @param messageHtml
     * @param appearance
     * @param contentAppearance
     */
    private NvgMessageBox(SafeHtml headingHtml, SafeHtml messageHtml, WindowAppearance appearance, MessageBoxAppearance contentAppearance) {
        super(headingHtml, messageHtml, appearance, contentAppearance);
    }

    /**
     * @param headingHtml
     * @param messageHtml
     */
    private NvgMessageBox(SafeHtml headingHtml, SafeHtml messageHtml) {
        super(headingHtml, messageHtml);
    }

    /**
     * @param headingHtml
     */
    private NvgMessageBox(SafeHtml headingHtml) {
        super(headingHtml);
    }

    /**
     * @param headingHtml
     * @param messageHtml
     * @param appearance
     * @param contentAppearance
     */
    private NvgMessageBox(String headingHtml, String messageHtml, WindowAppearance appearance, MessageBoxAppearance contentAppearance) {
        super(headingHtml, messageHtml, appearance, contentAppearance);
    }

    /**
     * @param headingHtml
     * @param messageHtml
     */
    private NvgMessageBox(String headingHtml, String messageHtml) {
        super(headingHtml, messageHtml);
    }

    /**
     * @param headingHtml
     */
    private NvgMessageBox(String headingHtml) {
        super(headingHtml);
    }

    public static MessageBox info(String message) {
        return info("CONSTANTS.info()", message);
    }
    
    public static MessageBox info(String title, String message) {
        MessageBox box = new MessageBox(title, message);
        box.setIcon(MessageBox.ICONS.info());
        box.show();
        return box;
    }
    
    public static MessageBox error(String message) {
        MessageBox box = new MessageBox("CONSTANTS.error()", message);
        box.setIcon(MessageBox.ICONS.error());
        box.show();
        return box;
    }
    
    public static MessageBox warn(String message) {
        MessageBox box = new MessageBox("CONSTANTS.warn()", message);
        box.setIcon(MessageBox.ICONS.warning());
        box.show();
        return box;
    }
    
    public static MessageBox questionYN(String message) {
    	return questionYNC(null, message);
    }
    
    public static MessageBox questionYN(String title, String message) {
        return question(title, message, PredefinedButton.YES, PredefinedButton.NO);
    }
    
    public static MessageBox questionYNC(String message) {
    	return questionYNC(null, message);
    }
    
    public static MessageBox questionYNC(String title, String message) {
        return question(title, message, PredefinedButton.YES, PredefinedButton.NO, PredefinedButton.CANCEL);
    }
    
    public static MessageBox question(String title, String message, PredefinedButton... buttons) {
    	if (title == null) {
    		title = "CONSTANTS.question()";
    	}
    	
        MessageBox box = new MessageBox(title, message);
        box.setPredefinedButtons(buttons);
        box.setIcon(MessageBox.ICONS.question());
        box.show();
        return box;
    }
}
